package com.test.common.repository.perf;

import com.test.common.entity.perf.PerfReportEntity;
import com.test.common.enums.perf.PerfReportStatEnum;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface PerfReportRepository extends JpaRepository<PerfReportEntity, Integer> {

    Optional<PerfReportEntity> findByUuid(String uuid);

    Page<PerfReportEntity> findAllByTaskId(int taskId, Pageable pageable);

    Page<PerfReportEntity> findAllByTaskIdAndScriptId(int taskId, int scriptId, Pageable pageable);

    Page<PerfReportEntity> findAllByScriptId(int scriptId, Pageable pageable);

    int countByStatus(PerfReportStatEnum status);

    List<PerfReportEntity> findAllByStatus(PerfReportStatEnum status);
}
